<template>
	<view class="content">
		<view class="logo-pic"><image src="../../../static/images/user/copy-logo.png" mode="widthFix" style="width: 100%;"></image></view>
		<view class="version-text">{{version}}</view>
		<view class="item" @tap="go">注册协议</view>
		<view class="copyright-text">Copyright@2018-2019</view><view class="copyright-text">广东恒朗科技有限公司版权所有</view>
		
		<view class="u-popup-mask" v-if="bIsShowMask" @touchmove.stop="">
			<view class="g-popup-share" @touchmove.stop="" :class="bIsShowMask?'show':''">
				<view class="g-share-type">
					<view @tap="share('weixin','WXSceneSession')">
						<image src="../../../static/icons/wxpay.png" mode="widthFix"></image>
						<view>微信好友</view>
					</view>
					<view @tap="share('weixin','WXSenceTimeline')">
						<image src="../../../static/icons/weixin_friend.png" mode="widthFix"></image>
						<view>朋友圏</view>
					</view>
				</view>
				<button class="u-share-cancel" @tap="closePopup">取消</button>
			</view>
		</view>
		<view class="m-full-loading" v-if="showLoading">
		    <image src="../../../static/images/loading.gif"></image>
		</view>
	</view>
	
</template>

<script>
	export default {
		data() {
			return {
				title: '',
				registration_agreement:'',
				version:'',
				bIsShowMask: false, // 是否显示蒙版
				showLoading: false
			}
		},
		methods:{
			// 调用分享
			share(type, wx = '') { 
				let that = this
			    let share = uni.getStorageSync('app_share');
				that.showLoading = true
				console.log(share)
				uni.share({
			        provider: type,
			        scene: wx,
			        type: 0,
			        href: share.link,
			        title: share.title,
			        summary: share.description,
			        imageUrl: share.thumb,
			        success: function(res) {
						that.showLoading = false
					},
			        fail: function(err) {
						that.showLoading = false
					}
			    });
			},
			closePopup() {
				this.bIsShowMask = false;
			},
			go(){
				let that = this
				let article = uni.getStorageSync('article');
				uni.navigateTo({
					url:'/pages/common/article?id='+article.registration_agreement
				})
			}
		},
		onNavigationBarButtonTap(e) {
			this.bIsShowMask = true;
		},
		onLoad() {
			let that = this
			// #ifdef APP-PLUS
			that.version = plus.runtime.version
			plus.runtime.getProperty(plus.runtime.appid, function(widgetInfo) {
				that.version = widgetInfo.version
			})
			// #endif
			
		}
	}
</script>

<style>
	page{
		background-color: #f3f4f5;
	}
	.logo-pic{
		width: 263upx;
		height: 263upx;
		margin: 0 auto;
		margin-top: 40upx;
		
	}
	.version-text{
		font-size: 26upx;
		text-align: center;
		color: #6b6b6b;
		padding: 40upx 0;
	}
	.item{
		height: 73upx;
		line-height: 73upx;
		background: #ffffff;
		color: #000000;
		font-size: 30upx;
		padding: 0 30upx;
		background: url(../../../static/images/user/rihgt-icon.png) #ffffff 95% center no-repeat;
		background-size: 16upx 27upx;
		margin-bottom: 60upx;
	}
	.copyright-text{
		color: #6b6b6b;
		font-size: 26upx;
		text-align: center;
		line-height: 46upx;
	}
	.navigator-hover{
		background-color: #cccccc;
	}
	
	.u-popup-mask {
	    position: fixed;
	    left: 0;
	    top: 0;
	    width: 100vw;
	    height: 100vh;
	    background: rgba(0, 0, 0, .5);
	    z-index: 10;
	}
	.show {
	    transform: translateY(0) !important;
	}
	/* 分享弹框 */
	.g-popup-share {
	    position: absolute;
	    left: 0;
	    bottom: 0;
	    width: 100%;
	    background: #fff;
	    z-index: 11;
		transform: translateY(100%);
		transition: .3s;
	}
	
	.g-popup-share .g-share-type {
	    display: flex;
	    padding: 15px 0;
	}
	
	.g-popup-share .g-share-type view {
	    flex: 1;
	    text-align: center;
		font-size: 26rpx;
	}
	
	.g-popup-share .g-share-type image {
	    width: 75upx;
		height: 75upx;
	}
	
	.g-popup-share .u-share-cancel {
	    background: #a4a4a4;
	    padding: 10px 0;
	    color: #fff;
		font-size: 28rpx;
	}
	
</style>
